package com.ccut.xunfeiSpringboot.mapper;

import com.ccut.xunfeiSpringboot.entity.PositionInformation;
import com.ccut.xunfeiSpringboot.entity.RecommendCareers;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface JobMapper {

    @Select("select * from position_information order by id desc ")
    List<PositionInformation> getSelectedJobs();

    @Delete( "delete from position_information where id = #{id}")
    void removeJobById(Integer id);

    void addJob(PositionInformation job);

    @Select("select * from position_information where user_id = #{userId} and number_of_interviews > 0 order by id desc")
    List<PositionInformation> getInterviewedJobs(Integer userId);

    @Select("select * from position_information where user_id = #{userId} and number_of_interviews = 0 order by id desc")
    List<PositionInformation> getNotInterviewedJobs(Integer userId);

    @Update("update position_information set number_of_interviews = number_of_interviews + 1 where id = #{id}")
    void updateJob(Long id);
}
